<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/11/22,0022
  Time: 9:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>歌曲管理</title>
</head>
<body>
    <h1>欢迎您:${admin.username}</h1>
    <a href="/findAllSingerController">添加</a>
    <table border="1px black" width="600">
        <tr>
            <td>歌名</td>
            <td>歌手</td>
            <td>专辑</td>
            <td>操作</td>
        </tr>
        <c:forEach var="music" items="${pageInfo.getList()}">
            <tr>
                <td>${music.name}</td>
                <td>
                    <c:forEach items="${music.singer}" var="singer">
                        ${singer.sname}
                    </c:forEach>
                </td>
                <td>${music.album}</td>
                <td><a href="/DeleteMusicController?mid=${music.mid}">删除</a> | <a href="/FindOneMusicController?mid=${music.mid}">修改</a></td>
            </tr>
        </c:forEach>
    <tr>
        <td colspan="8">
            <%--1.判断是否显示上一页--%>
            <c:if test="${!pageInfo.isFirstPage}">
                <a href="/FindAllMusicController?currentPage=${pageInfo.getPrePage()}">
                    上一页
                </a>
            </c:if>
            <%--2.显示导航的页码数字--%>
            <c:forEach begin="${pageInfo.getNavigateFirstPage()}" end="${pageInfo.getNavigateLastPage()}" var="page">
                <a href="/FindAllMusicController?currentPage=${page}">
                        ${page}  &nbsp;
                </a>
            </c:forEach>
            <%--3.判断是否显示下一页--%>
            <c:if test="${!pageInfo.isLastPage}">
                <a href="/FindAllMusicController?currentPage=${pageInfo.getNextPage()}">
                    下一页
                </a>
            </c:if>
        </td>
    </tr>
    </table>
    <a href="/AdminLogoutController">退出</a>
</body>
</html>
